// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.statement.SQLTableElement;
// import com.alibaba.druid.sql.dialect.oracle.ast.OracleSQLObjectImpl;
// import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "OracleSupplementalLogGrp.h"
#include "../../../../ast/SQLName.h"
#include "../../visitor/OracleASTVisitor.h"
#include "../../../../../utils/listTran.h"

OracleSupplementalLogGrp::OracleSupplementalLogGrp()
{
  columns = std::make_shared<std::list<SQLName_ptr>>();
}
// @Override
void OracleSupplementalLogGrp::accept0(OracleASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(OracleSupplementalLogGrp)))
  {
    acceptChild(visitor, group);
    SQLObject_list_ptr tmp1 = ListTran::tran_class<SQLName, SQLObject>(columns);
    acceptChild(visitor, tmp1);
  }
  visitor->endVisit(SharedObject(OracleSupplementalLogGrp));
}

SQLName_ptr OracleSupplementalLogGrp::getGroup()
{
  return group;
}

void OracleSupplementalLogGrp::setGroup(SQLName_ptr group)
{
  if (group != nullptr)
  {
    group->setParent(SharedObject(OracleSupplementalLogGrp));
  }
  this->group = group;
}

SQLName_list_ptr OracleSupplementalLogGrp::getColumns()
{
  return columns;
}

void OracleSupplementalLogGrp::addColumn(SQLName_ptr column)
{
  if (column != nullptr)
  {
    column->setParent(SharedObject(OracleSupplementalLogGrp));
  }
  this->columns->push_back(column);
}

BOOL_ptr OracleSupplementalLogGrp::isAlways()
{
  return always;
}

void OracleSupplementalLogGrp::setAlways(BOOL_ptr always)
{
  this->always = always;
}

SQLObject_ptr OracleSupplementalLogGrp::clone()
{
  SQLObject_ptr clone_tmp = std::shared_ptr<OracleSupplementalLogGrp>(new OracleSupplementalLogGrp());
  std::shared_ptr<OracleSupplementalLogGrp> x = std::dynamic_pointer_cast<OracleSupplementalLogGrp>(clone_tmp);
  // OracleSupplementalLogGrp x = new OracleSupplementalLogGrp();
  if (group != nullptr)
  {
    x->setGroup(std::dynamic_pointer_cast<SQLName>(group->clone()));
  }
  for (SQLName_ptr column : *columns)
  {
    SQLName_ptr c2 = std::dynamic_pointer_cast<SQLName>(column->clone());
    c2->setParent(x);
    x->columns->push_back(c2);
  }
  x->always = always;
  return x;
}
